<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;

class Fate extends Common
{
	
	function fate($val,$pagesize=12)
	{
	}
	public function deleteFate($id)
	{
		if (!$this->REQUEST->isAjax()) return "非法操作";
		$where['id'] = ['in',$ids];
		if(Db::name('fate_topic')->where($where)->delete());
		return json(['code'=>1,'msg'=>'删除成功']);
   		return json(['code'=>0,'msg'=>'删除失败']);
	}
	public function toexamineFate($id,$sta)
	{
		if (!$this->REQUEST->isAjax()) return "非法操作";
		$where['id'] = ['in',$id];
		if(Db::name('fate_topic')->where($where)->setField('State',$sta));
		return json(['code'=>1,'msg'=>'更新成功']);
   		return json(['code'=>0,'msg'=>'更新失败']);
	}


	public function value()
	{
		$where = array();
		$vn = Db::name('fate_value')->where($where )->select();
		$arr = [
			'value_list'=>$vn,
		];
		return view('value',$arr);
	}
	public function topic()
	{
		$where = array();
		$vn = Db::name('fate_topic')->where($where )->select();
		foreach($vn as $v=>$n){
			$vn[$v]['Option'] = json_decode($n['Option'],true);
		}
		$arr = [
			'topic_list'=>$vn,
		];
		return view('topic',$arr);
	}
	
}
